package routes

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/context"
	"mdblog/controllers"
)

func init() {
	admin := beego.NewNamespace(
		controllers.AdminPrefixPath,
		beego.NSCond(func(context *context.Context) bool {
			return true
		}),
		beego.NSRouter("/login", &controllers.AdminControllers{}, "GET:Login"),
		beego.NSRouter("", &controllers.AdminControllers{}, "GET:Index"),
		beego.NSRouter("/console", &controllers.AdminControllers{}, "GET:Console"),

		// user & role
		beego.NSRouter("/users", &controllers.AdminControllers{}, "GET:Users"),
		beego.NSRouter("/user/create", &controllers.AdminControllers{}, "GET:AccountCreate"),
		beego.NSRouter("/user/changepass/:id", &controllers.AdminControllers{}, "GET:AccountChangePassword"),
		beego.NSRouter("/role", &controllers.AdminControllers{}, "GET:Role"),
		beego.NSRouter("/power", &controllers.AdminControllers{}, "GET:Power"),

		// ui
		beego.NSRouter("/drawer", &controllers.AdminControllers{}, "GET:Drawer"),
		beego.NSRouter("/message", &controllers.AdminControllers{}, "GET:Message"),
		beego.NSRouter("/loading", &controllers.AdminControllers{}, "GET:Loading"),
		beego.NSRouter("/table", &controllers.AdminControllers{}, "GET:Table"),
		beego.NSRouter("/treeTable", &controllers.AdminControllers{}, "GET:TreeTable"),
		beego.NSRouter("/form", &controllers.AdminControllers{}, "GET:Form"),
		beego.NSRouter("/formSelect", &controllers.AdminControllers{}, "GET:FormSelect"),
		beego.NSRouter("/button", &controllers.AdminControllers{}, "GET:Button"),
		beego.NSRouter("/err/403", &controllers.AdminControllers{}, "GET:Error403"),
		beego.NSRouter("/err/404", &controllers.AdminControllers{}, "GET:Error404"),
		beego.NSRouter("/err/500", &controllers.AdminControllers{}, "GET:Error500"),

		// blog 相关
		beego.NSRouter("/article/create", &controllers.BlogAdminController{}, "GET:ArticleCreate"),
		beego.NSRouter("/article/list", &controllers.BlogAdminController{}, "GET:ArticleList"),
		beego.NSRouter("/article/edit/:id", &controllers.BlogAdminController{}, "GET:ArticleEdit"),
		beego.NSRouter("/classify/list", &controllers.BlogAdminController{}, "GET:ClassifyList"),
		beego.NSRouter("/classify/create", &controllers.BlogAdminController{}, "GET:ClassifyAdd"),
		beego.NSRouter("/resource/list", &controllers.BlogAdminController{}, "GET:ResourceList"),
		beego.NSRouter("/targets/list", &controllers.BlogAdminController{}, "GET:ArticleTargets"),
		beego.NSRouter("/targets/create", &controllers.BlogAdminController{}, "GET:ArticleTargetCreate"),
		beego.NSRouter("/config/list", &controllers.BlogAdminController{}, "GET:SiteConfigList"),
		beego.NSRouter("/config/create", &controllers.BlogAdminController{}, "GET:SiteConfigCreate"),
		beego.NSRouter("/config/edit/:id", &controllers.BlogAdminController{}, "GET:SiteConfigEdit"),
		beego.NSRouter("/notice/list", &controllers.BlogAdminController{}, "GET:NoticeList"),
		beego.NSRouter("/notice/create", &controllers.BlogAdminController{}, "GET:NoticeCreate"),
		beego.NSRouter("/notice/edit/:id", &controllers.BlogAdminController{}, "GET:NoticeEdit"),
		beego.NSRouter("/carousel/list", &controllers.BlogAdminController{}, "GET:CarouselList"),
		beego.NSRouter("/carousel/create", &controllers.BlogAdminController{}, "GET:CarouselCreate"),
	)
	beego.AddNamespace(admin)
}
